$(function () {

  // let q = {
  //     sex: '',
  //     username: '',
  //     mobile: '',
  //     page: '',
  //     limit: '10',

  // }

  const query = {
    start_time: '',
    end_time: '',
    title: '',
    cateid: '',
    page: '1',
    limit: '10'
  };

  const layer = layui.layer
  const form = layui.form

  // ==================== 渲染数据 ====================
  getList()
  async function getList() {
    const res = await axios.get("/ydd_article/list")
    console.log(res);
    $('#list').html(res.data.data.data.map(item => {
      return `
            <tr>
            <td>${item.id}</td>
            <td>${item.title}</td>
            <td>${item.cateid}</td>
            <td><img src="http://124.223.14.236:8060/${item.pic}" alt=""></td>
            <td>${new Date(item.create_date)}</td>
            <td>${item.ishot = item.ishot === 0 ? '否' : '是'}</td>
            <td>${item.istop = item.istop === 0 ? '否' : '是'}</td>
            <td>${item.state = item.state === 1 ? '待审核' : '已发布'}</td>
            <td>
              <button type="button" class="layui-btn layui-btn-xs btn_edit" data-id="${item.id}">编辑</button>
              <button type="button" class="layui-btn layui-btn-danger layui-btn-xs btn_delete" data-id="${item.id}">删除</button>
            </td>
          </tr>
            `
    }).join(''))


  }








})